package com.js.nickcar.module.addcar.series;

import android.text.TextUtils;

import com.js.nickcar.api.HttpHelpter;
import com.js.nickcar.api.UrlConfig;
import com.js.nickcar.api.UrlUtils;
import com.js.nickcar.base.BaseRecyclerPresenter;
import com.js.nickcar.entity.remote.ApiResultBean;
import com.js.nickcar.entity.remote.CarBrandBean;
import com.js.nickcar.entity.remote.CarSeriesBean;

import java.util.ArrayList;
import java.util.Map;

import rx.Observable;


/**
 * Created by LZY on 2017/9/30.
 */
public class CarBrandDetailPresenter extends BaseRecyclerPresenter<CarSeriesBean, CarBrandDetailView> {

    public CarBrandBean mCarBrand;

    @Override
    public Observable<ApiResultBean<ArrayList<CarSeriesBean>>> getObservable() {
        String carBrandId = "";
        if (mCarBrand != null) {
            carBrandId = mCarBrand.getCar_brand_id();
        }
        Map<String, String> params = UrlUtils.getBaseRequestMap(UrlConfig.API_APPRAISER_CAR_SERIES);
        params.put("car_brand_id", TextUtils.isEmpty(carBrandId) ? "" : carBrandId);
        return HttpHelpter.getApiService().getCarSeries(params);
    }

    public void setCarBrand(CarBrandBean carBrand) {
        mCarBrand = carBrand;
    }

    public CarBrandBean getCarBrand() {
        return mCarBrand;
    }
}
